﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Data.Mapping {

    public partial class ReplyArticleMap
    : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<ReplyArticle> {
        public ReplyArticleMap() {
            ToTable("mc_ReplyArticle", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();

            //Relationships
            HasRequired(t => t.Article)
                .WithMany(t => t.ReplyArticles)
                .HasForeignKey(d => d.ArticleId)
                .WillCascadeOnDelete(false);

            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
        }
    }
}
